package top.zxybird.common.query;

/**
 * PrefixQuery.
 * 
 * Created by zxybird on 2017/11/16.
 */
public class PrefixQuery extends Query {
  protected String field;
  protected String values;

  public PrefixQuery(String field, String value) {
    this.field = field;
    this.values = value;
  }

  public String toString() {
    if (this.field != null && this.values != null && !this.values.isEmpty()) {
      StringBuilder stringBuilder = new StringBuilder(32);
      stringBuilder.append(this.field).append(":").append(this.escape(this.values)).append("*");
      return stringBuilder.toString();
    } else {
      return null;
    }
  }
}
